home *** CD-ROM | disk | FTP | other *** search
- Path: news1.h1.usa.pipeline.com!usenet
- From: grantp@usa.pipeline.com(Pete)
- Newsgroups: comp.lang.c++
- Subject: Class vs. Struct - was Re: No struct in C++!!?
- Date: 17 Feb 1996 00:15:10 GMT
- Organization: Kalevi, Inc.
- Message-ID: <4g36me$abk@news1.usa.pipeline.com>
- References: <31235E0C.252C@idi.oclc.org>
- NNTP-Posting-Host: pipe13.h1.usa.pipeline.com
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete)
- X-Newsreader: Pipeline USA v3.3.0
-
- On Feb 15, 1996 08:23:40 in article <Re: No struct in C++!!?>, 'Ron
- Unterreiner <runterreiner@idi.oclc.org>' wrote:
-
- >
- >A class is a struct. Anywhere you see the word struct you can substitute
-
- >the word class. The major thing a class gives you that a C struct
- >doesn't is the ability to protect data. You can control the way the data
-
- >in the class is accessed from outside by writing methods. It works much
- >like stacks and queues where you would define AddMember, DeleteMember and
-
- >TraverseMember functions. In a nutshell, a class is a really powerful
- >struct. You can define a class like a C struct though by making all your
-
- >data public. This is usually a bad idea because the data in the class
- >could get stepped on accidently if you are not careful. The whole
- >purpose of classes is to restrict access to the data inside.
-
- Actually there's a lot more to classes than protecting data.
- Read any OO book for for info.
-
- --
- Pete Grant
- Kalevi, Inc.
- Software Engineering & development
-